package com.ruoyi.wxapi;

import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.wx.domain.ACat;
import com.ruoyi.wx.service.IACatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * author：pan
 * 微信小程序  猫咪信息（获取）
 *
 */

@RestController
@RequestMapping("/wxapi")
public class WxCatSearchController {

    @Autowired
    private IACatService iaCatService;

    @Autowired
    private StringRedisTemplate redisTemplate;

    /**
     * 用户搜索 猫猫
     * @param keyword
     * @return
     */
    @GetMapping("/getSeachCat")
    public AjaxResult getSeachCat(@RequestParam(name = "keyword") String keyword){

        System.out.println("用户搜索输入："+ keyword);

        List<ACat> aCatList = iaCatService.selectACatSearchList(keyword);

        return AjaxResult.success("搜索成功！",aCatList);
    }

}
